package com.nuanshui.heatedloan.middleware.util;

import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Created by zxh on 2017/5/20.
 */
public class HttpRequestUtil {

    public static String getRequestString(HttpServletRequest request) {
        BufferedReader in = null;
        try {
            in = new BufferedReader(new InputStreamReader(request.getInputStream()));
            StringBuilder sb = new StringBuilder();
            String line = null;
            while ((line = in.readLine()) != null) {
                sb.append(line);
            }
            return sb.toString();
        } catch (IOException e) {
            e.printStackTrace();
        }

        return null;
    }
}
